package com.example.tongue.Test;

import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class OkhttTest {
    private final OkHttpClient client = new OkHttpClient();
    private String run(String url) throws IOException {
        Request request = new Request.Builder()
                .url(url)
                .build();

        try (Response response = client.newCall(request).execute()) {
            return response.body().string();
        }
    }

    public static void main(String[] args) throws IOException {
       OkhttTest okhttTest=new OkhttTest();
        String response = okhttTest.run("http://localhost:8080/hello");
        System.out.println(response);
    }
}